<script>
	// import {
	// 	TUILogin
	// } from '@tencentcloud/tui-core';
	// // #ifdef APP-PLUS || H5
	// import {
	// 	TUIChatKit
	// } from '@/TUIKit';
	// TUIChatKit.init();
	// // #endif

	// let vueVersion = 2;
	// // #ifdef VUE3
	// vueVersion = 3;
	// // #endif

	// Required information
	// You can get userSig from TencentCloud chat console for Testing TUIKit.
	// Deploy production environment please get it from your server.
	// View https://cloud.tencent.com/document/product/269/32688
	// uni.$SDKAppID = ''; // Your SDKAppID
	// uni.$userID = ''; // Your userID
	// uni.$userSig = ''; // Your userSig

	export default {
		async onLaunch(options) {
			if (options.query.key === 'binding') {
				let http = `${window.location.href}`
				if (!options.query.code) {
					window.location.href =
						`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${options.query.appid}&redirect_uri=${encodeURIComponent(http.replace("#", "virtually"))}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
				}
				return;
			} else if (options.query.key === 'pc') {
				return;
			} else {
				try {
					await this.$store.dispatch('login/loginAction');
				} catch (error) {}
			}

			// plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
			// console.log(widgetInfo, 'widgetInfo')
			// })

			// uni.onPushMessage((res) => {
			// });

			// #ifdef APP-PLUS
			// if (this.token) {
			// 	//存在则关闭启动页进入首页
			// 	uni.reLaunch({
			// 		url: "/pages/index/index",
			// 		success: () => {
			// 			plus.navigator.closeSplashscreen();
			// 			this.clearAppBadge();
			// 		},
			// 	});
			// } else {
			// 	//不存在则跳转至登录页
			// 	plus.navigator.closeSplashscreen();
			// }
			// #endif
		},
		onShow() {},
		onHide() {},
		computed: {},
		methods: {},
	};
</script>

<style lang="scss">
	/* 引入uView基础样式 */
	@import "@/uni_modules/uview-ui/index.scss";
	/* 每个页面公共css */
	@import "@/assets/css/index.scss";

	page {
		background-color: $uni-common-bg-color;
	}

	view {
		font-family: PingFang SC;
		box-sizing: border-box;
	}
</style>